package Utils

import (
	"bytes"
	"encoding/binary"
	"fmt"
)



func BytesToStruct(bys []byte, pStruct interface{}) *interface{}  {
	buf := bytes.NewBuffer(bys)
	//obj := tCopy{}
	if err := binary.Read(buf, binary.LittleEndian, pStruct); err != nil{
		fmt.Println("error", err)
		return nil
	}
	return &pStruct
}

func BytesToInt64(buf []byte) int64 {
	return int64(binary.LittleEndian.Uint64(buf))
}

func BytesToInt32(buf []byte) int32 {
	return int32(binary.LittleEndian.Uint32(buf))
}

